package com.ourchem.web.controller.bus;

import com.ourchem.bus.dto.QueryParamDTO;
import com.ourchem.bus.feign.ProDataFeignService;
import com.ourchem.bus.service.NacosDataTokenService;
import com.ourchem.common.core.domain.AjaxResult;
import com.ourchem.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Author jh
 * @Description
 * @Date created in 10:57 2022/3/28
 */
@RestController
@RequestMapping("/data/search")
public class ProDataFeignController {

    @Autowired
    private ProDataFeignService proDataFeignService;

    /**
     *
     * 壹专利search接口
     * @return
     */
//    @PreAuthorize("@ss.hasPermi('bus:competitorLibrary:competitorDatabaseSearch')")
    @PostMapping("/query")
    public AjaxResult Search(@RequestBody QueryParamDTO queryParamDTO){
        if(StringUtils.isEmpty(queryParamDTO.getSearchExpre())){
            return AjaxResult.success("操作成功","{\"hits\":0,\"result\":[]}");
        }
        String jsonStr =proDataFeignService.search(queryParamDTO);
        return AjaxResult.success("操作成功",jsonStr);
    }

}
